#include<iostream>
#include<string.h> // *nix speficiation for strlen

using namespace std;

//is_palindrome
//input: a string
//output: whether the string is a palindrome
bool is_palindrome(char s[])
{
	int len = strlen(s);
	int i; // looper
	i=0;
	while(i<len)
	{
		if(s[i] != s[len-1-i])
			return false;
		i++;
	}
	return true;
}

//switch_letters
//input: a string
//ouput: the neighboring letters are swapped.
void switch_letters(char s[])
{
	int i; // looper
	char swap; // used to swap letters
	for(i=0;i<strlen(s);i+=2)
	{
		swap = s[i+1];
		s[i+1] = s[i];
		s[i] = swap;
	}
}

//remove_char
//input: a string an a char
//output: removes the apperance of the char
void remove_char(char s[], char ch)
{
	int i,j;
	for(i=0;i<strlen(s);i++)
		if(s[i]==ch)
			for(j=i;j<strlen(s);j++)
			{
				s[j] = s[j+1];
			}

}

//str_str
//input: two strings
//output: the index of the first apperance of s2 in s1.
int str_str(char s1[], char s2[])
{
	int i,j; //looper
	bool flag;
	for(i=0;i<strlen(s1);i++)
		if(s1[i] == s2[0])
		{
			flag = true;
			for(j=0;j<strlen(s2);j++)
				if(s1[i+j]!=s2[j]) flag = false;
			if(flag) return i;
		}
	return -1;

}

//str_to_int
//input: a string.
//output: int with the string value.
int str_to_int(char s[])
{
	int i; //looper
	int res;
	res = 0;
	for(i=0;i<strlen(s);i++)
	{
		res*=10;
		res+= (int)s[i] - '0';
	}
	return res;

}
//ouput
//None - there is no main to this task.
